<%--
  Created by IntelliJ IDEA.
  User: asus
  Date: 2022/10/29
  Time: 11:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>我想要的</title>
    <link type="text/css" href="css/idea.css" rel="stylesheet" />
    <link type="text/css" href="css/user_home.css" rel="stylesheet" />
    <link type="text/css" href="css/common.css" rel="stylesheet" />
    <link type="text/css" href="css/reset.css" rel="stylesheet" />
    <link rel="shortcut icon" type="image/x-icon" href="images/nangua.jpg" media="screen" />
    <link type="text/css" href="css/user_home_favorite.css" rel="stylesheet" />
    <script type="text/javascript" src="js/jquery-1.8.2.min.js"></script><!--必须得放在第一的位置-->
    <script type="text/javascript" src="js/index_type_more.js"></script>

    <script type="text/javascript" src="js/user_home.js"></script>
    <script type="text/javascript" src="js/user_home_order.js"></script>
    <script type="text/javascript" src="js/user_home_favorite.js"></script>
</head>

<body>

<script>
    function deletepush(id) {
        if(confirm("确定删除吗？")){
            location.href='removefavorite.do?id='+id;
        }
    }
</script>
<script type="text/javascript">

    //加载出我想要的车辆

    $(document).ready(function () {
           myjump(1,3);
    });
    function myjump(page,size) {
        $.ajax({
            url:"getPushListByUserId.do",
            type:"GET",
            data:{page:page,size:size},
            dataType:"json",
            success:function (msg) {
                if(msg.flag==1){
                    var datalist=msg.data.olist;
                    var html='';
                    for (var i = 0; i<datalist.length; i++) {
                        html+='<div class="content_goods_favorite_con_con ">';
                        html+='<div class="con_goods1 fl clearfix">';
                        html+='</div>';
                        html+='<div style="font-size: 15px;">';
                        html+='<div style="width: 212px;float: left">'+datalist[i].push_carname+'</div>';
                        html+='<div style="width: 170px;float: left">'+datalist[i].push_brand+'</div >';
                        html+='<div style="width: 185px;float: left">'+datalist[i].push_dept+'</div>';
                        html+='<div style="width: 170px;float: left">'+datalist[i].push_price+'万</div>';
                        html+='<div style="width: 173px;float: left">'+datalist[i].push_status+'</div>';
                        html+='<div style="width: 40px;float: left"><a href="javascript:deletepush('+datalist[i].push_id+')">删除</a></div>';
                        html+='</div>';
                        html+='</div>';
                        html+='<div class="hr_10"></div>';
                    }
                    var str = ''
                    str='<a href="javaScript:myjump(1,3)" style="padding: 4px 10px;background: #fff;color: #0B6FB0;font-size: 14px;margin: 0 3px;text-decoration: none;">首页</a>&nbsp;'+
                        '<a href="javaScript:myjump('+(msg.data.page-1)+',3)"style="padding: 4px 10px;background: #fff;font-size: 14px;color: #0B6FB0;margin: 0 3px;text-decoration: none;">上一页</a>&nbsp;'+
                        '<a href="javaScript:myjump('+(msg.data.page+1)+',3)"style="padding: 4px 10px;background: #fff;font-size: 14px;color: #0B6FB0;margin: 0 3px;text-decoration: none;">下一页</a>&nbsp;'+
                        '<a href="javaScript:myjump('+msg.data.maxPage+',3)"style="padding: 4px 10px;background: #fff;font-size: 14px;color: #0B6FB0;margin: 0 3px;text-decoration: none;">尾页</a>' ;

                    $("#myfavoritelist").html(html);//数据列表
                    $("#favoritenum").html(msg.data.allCount);//全部想要
                    $("#pageandsize").html(str);//分页
                }else if(msg.flag==0){
                    if(msg.info=="您尚未登录请先登录!"){
                        alert("您尚未登录请先登录!");
                        location.href="user_login.jsp";
                    }else{
                        $("#myfavoritelist").html("您没有想要的车，快告诉我们您想要的车车吧");
                        $("#favoritenum").html(msg.data.allCount);//全部想要
                    }

                }
            }

        });
    }
</script>
<script>
    //跳转到详情页
    function goCarInformation(id) {
        location.href="queryCarByid.do?car_id="+id;
    }
</script>
<script>
    //喜欢车的信息
    $(document).ready(function () {
        getFavoriteCar(0,3);
    });
function getFavoriteCar(page,size) {
    $.ajax({
        url: "getFavorite.do",
        dataType: "json",
        data: {page:page,size:size},
        type: "GET",
        success:function (msg) {
           var content=msg.data;
           var  html="";
           for(var i=0;i<content.length;i++){
               html+='<div class="buy_content_con_margin_l"><!--只用来向右移动的，这样才不会有一个因为父级宽度不够出现在下方-->';
               html+='<div class="buy_content_con_c'+i+' buy_content_con_c details_buy_li width_h_292_276 over_hidden fl"><!--只用来设置内边距--><!--用来设置外右边距-->';
               html+='<div class="buy_content_con_cc width_h_292_276">';
               html+='<div class="buy_content_con_pic width_h_292_186">';
               html+='<img src="${applicationScope.basePath}'+'upload/'+content[i].pic_main+'" width="292" height="186"/>';
               html+='</div>';
               html+='<div class="buy_content_con_txt width_h_292_90">';
               html+='<p class="p1">';
               html+='<a title="" href="javascript:goCarInformation(\''+content[i].car_id+'\')">'+content[i].push_carname+'</a>';
               html+='</p>';
               html+='<p class="p2">';
               html+='<span class="">'+content[i].car_regist+'上牌</span><em class="shuxian">|</em>行驶'+content[i].car_mile+'万公里';
               html+='</p>';
               html+='<p class="p3">';
               html+='<span><i class="fc-org priType">'+content[i].car_price+'万</i></span><s>'+content[i].car_newprice+'万</s>';
               html+='</p>';
               html+='</div>';
               html+='</div>';
               html+='</div>';
               html+='</div>';
           }
           $("#myfavoritecar").html(html);

            var str1=
                '<a href="javascript:getFavoriteCar(1,' +size
                + ')">首页</a>&nbsp;&nbsp;&nbsp;'+
                '<a href="javascript:getFavoriteCar('+(page-1)+',' + size
                + ')">上一页</a>&nbsp;&nbsp;&nbsp;'+
                // + '<span id="myspan"></span>'+
                '<a href="javascript:getFavoriteCar('+(page+1)+',' + size
                + ')">下一页</a>&nbsp;&nbsp;&nbsp;'+
                '<a href="javascript:getFavoriteCar('+msg.maxPage+',' + size
                + ')">尾页</a>';
             $("#myindex").html(str1);


        }

    })


}
</script>

<div class="index">
    <!--头部导航-->
    <jsp:include page="head.jsp"></jsp:include>
    <!--头部导航结束-->
    <div class="hr_5"></div>
    <div class="user_content f_f width_1200_center">
        <div class="content_position">您当前的位置：<a href="javascript:">首页</a><span>&gt;</span><a href="userhome.jsp">个人中心</a><span>&gt;</span><a href="mycar.jsp">我想要的</a></div>
        <!-- <div class="user_content_top f_z15"><a href="#">注册会员</a><span>Register</span></div>-->
        <div class="hr_10"></div>
        <div class="user_content_con over_hidden width_1200_center"><!--over_hidden也是清除浮动的一种-->
            <div class="user_content_con_nav fl" style="height: 440px">
                <div class="nav_info">
                    <h1>个人信息</h1>
                    <ul>
                        <li><a href="userhome.jsp">个人资料</a></li>
                        <li><a href="#">收货地址</a></li>
                        <li><a href="#">安全设置</a></li>
                    </ul>
                </div>
                <div class="nav_goods">
                    <h1>商品管理</h1>
                    <ul>
                        <li><a href="order.jsp">我的订单</a></li>
                        <li><a href="mycar.jsp">我卖的车</a></li>
                        <li><a href="mywantsellcar.jsp">卖车预约</a></li>
                        <li><a href="myfavorite.jsp">我想要的</a></li>
                        <li><a href="mycollection.jsp">我的收藏</a></li>
                        <li><a href="myreserve.jsp">看车预约</a></li>
                    </ul>
                </div>

            </div>
            <!--右侧购物车-->
            <div class="user_content_con_c fr">
                <div class="content_goods_favorite f_f width_1000_center">
                    <div class="content_goods_favorite_top over_hidden width_1000_center">
                        <div class="top_favorite fl"><h1>我想要的</h1></div>                                  <!--全部想要-->
                        <div class="top_all fr"><span class="span1">蓝瓜店-全部想要</span><span class="span2" id="favoritenum"></span></div>
                    </div>
                    <div class="content_goods_favorite_con width_1000_center clearfix">
                        <div class="content_goods_favorite_con_top">
                          <!--  <div class="con_check fl"><input class="check_all" type="checkbox" id="con_check1"/><span><label for="con_check1">全选</label></span></div>-->
                           <div>
                               <h1 style="float: left;margin-left:50px;" >描述</h1>
                               <h1 style="float: left;margin-left:150px;">品牌</h1>
                               <h1 style="float: left;margin-left:150px;">系别</h1>
                               <h1 style="float: left;margin-left:150px;">价格</h1>
                               <h1 style="float: left;margin-left:150px;">状态</h1>
                               <h1 style="float: left;margin-left:136px;">操作</h1>
                           </div>

                        </div>
                        <div class="hr_5"></div>


                        <!--数据类表-->
                        <div id="myfavoritelist">


                        </div>
                        <!--分页-->

                        <div align="center" id="pageandsize" style="margin-left: 740px">


                        </div>
                        <!--分页-->
                    </div>
                </div>
            </div><!--右侧购物车完-->
        </div><!--左右侧完-->
        <!--以后复制的开始-->
        <div class="hr_10"></div>
        <div class="buy_content_li width_1200_center">
            <div class="buy_content_li_top clearfix">
                <div class="buy_content_li_top_default fl"><a href="#">蓝瓜推荐</a></div>
                <div class="buy_content_li_top_num fr"><a href="#"></a></div>
            </div>
            <div class="hr_5"></div>
            <div class="buy_content_li_list over_hidden clearfix" id="myfavoritecar">
                <%--<script type="text/javascript">--%>
                    <%--var html='';--%>
                    <%--for (var i = 1; i<=4; i++) {--%>
                        <%--html+='<div class="buy_content_con_margin_l"><!--只用来向右移动的，这样才不会有一个因为父级宽度不够出现在下方-->';--%>
                        <%--html+='<div class="buy_content_con_c'+i+' buy_content_con_c details_buy_li width_h_292_276 over_hidden fl"><!--只用来设置内边距--><!--用来设置外右边距-->';--%>
                        <%--html+='<div class="buy_content_con_cc width_h_292_276">';--%>
                        <%--html+='<div class="buy_content_con_pic width_h_292_186">';--%>
                        <%--html+='<img src="images/112.png" width="292" height="186"/>';--%>
                        <%--html+='</div>';--%>
                        <%--html+='<div class="buy_content_con_txt width_h_292_90">';--%>
                        <%--html+='<p class="p1">';--%>
                        <%--html+='<a title="现代瑞纳2014款 1.4 自动 GLS 智能型" href="#">现代瑞纳2014款 1.4 自动 GLS 智能型</a>';--%>
                        <%--html+='</p>';--%>
                        <%--html+='<p class="p2">';--%>
                        <%--html+='<span class="">2015年1月上牌</span><em class="shuxian">|</em>行驶1.9万公里';--%>
                        <%--html+='</p>';--%>
                        <%--html+='<p class="p3">';--%>
                        <%--html+='<span><i class="fc-org priType">6.60万</i></span><s>9.40万</s>';--%>
                        <%--html+='</p>';--%>
                        <%--html+='</div>';--%>
                        <%--html+='</div>';--%>
                        <%--html+='</div>';--%>
                        <%--html+='</div>';--%>
                    <%--}--%>
                    <%--document.write(html);--%>
                <%--</script>--%>
            </div><!--遍历内容部分完-->
            <div align="center" id="myindex">


            </div>
        </div>
        <!--分页-->


        <!--分页-->
    </div>
        </div><!--整个遍历内容部分完-->
        <!--以后复制的结束-->

    </div><!--整个内容部分-->






    <div class="hr_8"></div>
    <!--底部-->
    <jsp:include page="foot.jsp"></jsp:include>
    <!--底部-->
</div>

</body>
</html>
